<template>
	<view class="page_box">
		<view class="head_box " v-if="0">
			<yy-custom bgColor="bg-gradual-blue">
				<block slot="backText">返回</block>
				<block slot="content">导航栏</block>
			</yy-custom>
		</view>

		<view class="content_box">
			<view class="head  padding flex justify-between bg-white">
				<view class="flex">
					<image
						:src="user.headimgurl"
						mode="aspectFill"
						style="width: 120rpx; height: 120rpx;"
						class="round "
					></image>
					<view class="flex flex-direction justify-around margin-left">
						<view class="flex  align-center ">
							<text class="f30">{{user.nickname}}</text>
							<view class="flex tt align-center justify-around margin-left-sm">
								<text class="cuIcon-favorfill " style="color: #fbb03b;"></text>
								<text class="f26 text-white">{{user.level}}</text>
							</view>
						</view>
						<text class="text-gray f24">{{user.modifyDt}}</text>
					</view>
				</view>
				<view class="flex">
					<view class="solid-left margin-right"></view>
					<view class="flex flex-direction justify-around align-center">
						<text class="f34 text-black text-bold">{{sum}}</text>
						<text class="f24 text-gray">订单总数</text>
					</view>
				</view>
			</view>
		
			<view
				class="padding-lr padding-tb-lg flex flex-direction bg-white margin-top"
				v-for="(item, index) in data"
				:key="index"
			>
				<view class="flex justify-between text-gray">
					<text class="f24">{{item.time}}</text>
					<text class="f28">共{{item.totle}}盒</text>
				</view>
				<block v-for="(item1, index1) in item.order" :key="index1">
					<view class="padding-tb flex align-center solid-bottom">
						<image
							:src="item1.commodityImg"
							mode="aspectFill"
							style="width: 81rpx; height: 69rpx;"
							class="  "
						></image>
						<view class=" margin-left flex flex-direction justify-around ">
							<text class="text-black f28">{{item1.commodityName}}（{{item1.commodityType}}）</text>
							<text class="text-gray f26 margin-top-sm">补货数量(盒)：{{item1.num}}</text>
						</view>
					</view>
				</block>
			</view>
		</view>
		<view class="foot_box"></view>
		<!-- 登录提示 -->
		<yy-login v-if="false"></yy-login>
		<!-- 加载提示 -->
		<yy-loading text="加载中.." mask="true" click="true" ref="loading"></yy-loading>
		<!-- 信息提示-->
		<u-toast ref="uToast" />
	</view>
</template>

<script>
import vSwitch from '@/components/v-switch/v-switch';
export default {
	components: {
		vSwitch
	},
	data() {
		return {
			checked: false,
			size: 10,
			current: 1,
			data: [],
			user:{},
			sum:''
		};
	},
	onShow() {},
	onLoad(e) {
		console.log('e :>> ', e);

		this.ordrLst(e.id);
	},
	methods: {
		async ordrLst(userId) {
			let obj = {
				userId,
				size: this.size,
				current: this.current
			};
			const res = await this.$u.get('order/peersOrder', obj, {});
			if (res.code == 0) {
				this.data = res.data.data;
				this.user = res.data.user
				this.sum = res.data.sum
			}

			console.log('res >>  ', res);
		},
		jump(url) {
			console.log('url: ', url);
			uni.navigateTo({
				url
			});
		},
		toggleMode(status) {
			console.log(status);
		}
	}
};
</script>

<style lang="scss" scoped>
.page_box {
	// width: 100vw;
	// height: 100vh;
	// overflow: scroll;
	background-color: #f7f7f7;
	.content_box {
		.head {
			.tt {
				width: 80rpx;
				height: 30rpx;
				background: linear-gradient(139deg, #393b56, #4f4f62);
				border-radius: 10rpx;
			}
		}
	}
}
</style>
